<?php 
class faqAction extends sfAction{
	private $data = array();
	public function execute($request){
		$this->data['cate_id'] = $request->getParameter('cate_id','-1');
		$this->data['banners']		= BannersTable::getDataListFrontend();
		$this->data['form']			= $request->getParameter('FaqsSend');
		$form = new FaqsSendForm();
		if($request->isMethod('POST')){
			if(!CaptchaHelper::isValidate($this->data['form']['captcha']) || empty($this->data['form']['captcha'])){
				unset($this->data['form']['captcha']);
			}
			$form->bind($this->data['form']);
			if($form->isValid()){
				if(FaqsTable::insert($this->data['form'])){
					$this->setTemplate('faqAdded');
				}
			}
			CaptchaHelper::clearCaptcha();
		}
		$this->setVar('data', $this->data);
		$this->setVar('form', $form);
		
		
	}
}